<%@page import="com.xnx3.j2ee.Global"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>  
<%@ taglib uri="http://www.xnx3.com/java_xnx3/xnx3_tld" prefix="x" %>
<jsp:include page="/wm/common/head.jsp">
	<jsp:param name="name" value="订单详情列表"/>
</jsp:include>
<script src="/<%=Global.CACHE_FILE %>Order_state.js"></script>
<style>
	h2{
		padding-top: 12px;
	    padding-bottom: 5px;
	}
</style>

<div style="margin-top: 10px; text-align: center;">
<h2>取件信息</h2>
<table class="layui-table iw_table"  style="color: black;font-size: 14px;" id="orderDate">
	<tr>
		<th style="text-align:center;width:80px;">出售人姓名</th>
		<th>{username}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:90px;">出售人手机号</th>
		<th>{phone}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">骑手姓名</th>
		<th>{qishouName}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">骑手手机号</th>
		<th>{qishouPhone}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">下单时间</th>
		<th>{addtime}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">预约时间</th>
		<th>{reserveStartTime}&nbsp;~&nbsp;{reserveEndTime}</th>
	</tr>
	 <tr>
		<th style="text-align:center; width:80px;">订单状态</th>
		<th>
			{state}
		</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">完成时间</th>
         <th>{payTime}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">预计金额(元)</th>
		<th>{totalMoney}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">实付金额(元)</th>
		<th>{payMoney}</th>
	</tr>
	<tr>
		<th style="text-align:center;width:80px;">总重量(kg)</th>
		<th>{allWeight}</th>
	</tr>
	<tr>
		<th style="text-align:center; width:80px;">备注</th>
		<th>{remark}</th>
	</tr>
	<tr>
		<th style="text-align:center; width:80px;">地址</th>
		<th>{address}</th>
	</tr>
<!-- 	<tr >
		 <th style="text-align:center; width:80px;">商品图片</th>
		 <th>
	     	<div id="tbody">
	 			<img style="width: 50px;height: 50px" src="{image}" onclick="tzurl('{image}')"> 
			</div>	
		</th> 
	</tr> -->
</table>

</div>
<script type="text/javascript">
//自适应弹出层大小
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引

//列表的模版
 var orderTemplate = document.getElementById("orderDate").innerHTML;

function orderDate(order){
	if(order.payTime == 0){
		return orderTemplate.replace(/\{username\}/g, order.username)
		.replace(/\{phone\}/g, order.phone)
		.replace(/\{qishouName\}/g, order.qishouName)
		.replace(/\{qishouPhone\}/g, order.qishouPhone)
		.replace(/\{addtime\}/g, formatTime(order.addtime,'Y-M-D h:m'))
		.replace(/\{reserveStartTime\}/g, formatTime(order.reserveStartTime,'Y-M-D h:m'))
		.replace(/\{reserveEndTime\}/g, formatTime(order.reserveEndTime,'h:m'))
		.replace(/\{state\}/g, state[order.state])
		.replace(/\{payTime\}/g, '')
		.replace(/\{totalMoney\}/g, order.totalMoney/100)
		.replace(/\{payMoney\}/g, order.payMoney/100)
		.replace(/\{allWeight\}/g, order.allWeight/1000)
		.replace(/\{remark\}/g, order.remark)
		.replace(/\{address\}/g, order.address)
		;
	}
	return orderTemplate.replace(/\{username\}/g, order.username)
		.replace(/\{phone\}/g, order.phone)
		.replace(/\{qishouName\}/g, order.qishouName)
		.replace(/\{qishouPhone\}/g, order.qishouPhone)
		.replace(/\{addtime\}/g, formatTime(order.addtime,'Y-M-D h:m'))
		.replace(/\{reserveStartTime\}/g, formatTime(order.reserveStartTime,'Y-M-D h:m'))
		.replace(/\{reserveEndTime\}/g, formatTime(order.reserveEndTime,'h:m'))
		.replace(/\{state\}/g, state[order.state])
		.replace(/\{payTime\}/g, formatTime(order.payTime,'Y-M-D h:m'))
		.replace(/\{totalMoney\}/g, order.totalMoney/100)
		.replace(/\{payMoney\}/g, order.payMoney/100)
		.replace(/\{allWeight\}/g, order.allWeight/1000)
		.replace(/\{remark\}/g, order.remark)
		.replace(/\{address\}/g, order.address)
		;
} 
/* var goodsListTemplate = document.getElementById("tbody").innerHTML;
function goodsListDate(item){
	return goodsListTemplate.replace(/\{image\}/g, item.image);
	
} */

msg.loading('加载中');
var id = getUrlParams('id');
post('/superadmin/order/orderDetails.json?id='+ id,{},function(data){
	msg.close();    //关闭“更改中”的等待提示
	checkLogin(data);	//验证登录状态。如果未登录，那么跳转到登录页面
	if(data.result == '1'){
		//登录成功
		document.getElementById("orderDate").innerHTML = orderDate(data.order);
		//列表
/* 		var html = '';
		for(var index in data.goodsList){
			var item = data.goodsList[index];
			html = html + goodsListDate(item);
		}
		document.getElementById("tbody").innerHTML = html; */
	}
});
/* function tzurl(e){
	window.open(e);
} */
</script>
<jsp:include page="/wm/common/foot.jsp"></jsp:include>